package com.jiuyue.demo.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jiuyue.demo.entity.ExternalUser;
import com.jiuyue.demo.service.ElasticSearchService;

@Controller
@RequestMapping("es")
public class ElasticSearchController {
	
	
	@Resource
	private ElasticSearchService elasticSearchService;
	
	
	@ResponseBody
	@RequestMapping("/saveAllUser")
	public String saveAllUser() {
		return elasticSearchService.saveAllUser();
	}
	
	
	@ResponseBody
	@RequestMapping("/getAllUser")
	public String getAllUser() {
		return elasticSearchService.getAllUser();
	}
	
	@ResponseBody
	@RequestMapping("/getUserByTag")
	public  Object getUserByTag() {
		return elasticSearchService.getUserByTag();
	}
	@ResponseBody
	@RequestMapping("/findUserByTag")
    public Object findUserByTag(String tenantId,String userId,String tags,String beginTime,String endTime,String addWay,String status,Integer pageNum, Integer pageSize){
		System.out.println(tags);
		System.out.println(beginTime);
		System.out.println(endTime);
		System.out.println(addWay);
		System.out.println(status);
       return elasticSearchService.findUserByTag(tenantId,userId,tags,beginTime,endTime,addWay,status,pageNum,pageSize);
    }

	@ResponseBody
	@RequestMapping("/insertUserById")
	public Object insertUserById(int id) {
		return elasticSearchService.insertUserById(id);
	}
	
	@ResponseBody
	@RequestMapping("/delUserById")
	public Object delUserById(int id) {
		return elasticSearchService.delUserById(id);
	}
	
	
	
	
	
	
	
	

}
